package logic

import (
	"context"

	"hm-zero-mall/apps/address/pb"
	"hm-zero-mall/apps/address/rpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type DeleteAddressLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDeleteAddressLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteAddressLogic {
	return &DeleteAddressLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// DeleteAddress 删除地址
func (l *DeleteAddressLogic) DeleteAddress(in *pb.AddressIdReq) (*pb.Empty, error) {
	err := l.svcCtx.AddressModel.Delete(l.ctx, in.Id)
	return &pb.Empty{}, err
}
